<table class="gridview" width="100%" cellpadding="0" cellspacing="0" border="0">
    <thead>
    <tr>
        <td><b>ID</b></td>
        <td><b>Tên</b></td>
        <td><b>Tên đăng nhập</b></td>
        <td><b>Chức vụ</b></td>
        <td><b>Kích hoạt</b></td>
        <td><b>Email</b></td>
        <td><b>Thao tác</b></td>
    </tr>
    </thead>
    <tbody>
    <tr class="filters">
        <td>
            <input placeholder="ID" type="text" class="small_filter" name="filters[a.id][value]" value="<?php echo $filters['a.id']['value']; ?>" />
            <input type="hidden" value="equal" name="filters[a.id][type]" />
        </td>
        <td colspan="3">
            <input placeholder="Tên người dùng / Username / Email" type="text" class="wide_filter" name="filters[a.name][value]" value="<?php echo $filters['a.name']['value']; ?>" />
            <input type="hidden" value="text" name="filters[a.name][type]" />
        </td>
        <td colspan="2">
            <select style="width: 99%" id="filters_is_active" name="filters[is_active][value]" onchange="$('#frm_admin_grid').submit()">
                <option value="-1">Tất cả trạng thái</option>
                <option value="1" <?php if ($filters['is_active']['value'] == 1) :?>selected="selected"<?php endif; ?>>Đã kích hoạt</option>
                <option value="0" <?php if ($filters['is_active']['value'] == 0) :?>selected="selected"<?php endif; ?>>Chưa kích hoạt</option>
            </select>
            <input type="hidden" value="equal" name="filters[is_active][type]" />
            <input type="hidden" value="-1" name="filters[is_active][exclude]" />
        </td>
        <td width="200px">
            <button class="gray_btn" type="submit" onclick="admin_site_admin.act_filter();">
                <span>Lọc</span>
            </button>
            <button class="gray_btn" type="button" onclick="admin_site_admin.reset_filters();">
                <span>Xóa lọc</span>
            </button>
        </td>
    </tr>
    <?php if (!empty($collection)) :?>
        <?php foreach ($collection as $admin) : ?>
        <tr data-id="<?php echo $admin->id; ?>" data-name="<?php echo $admin->name; ?> <?php echo $admin->username; ?> <?php echo $admin->email; ?>" data-role-id="<?php echo $admin->role_id; ?>" data-is-active="<?php echo $admin->is_active; ?>">
            <input type="hidden" value="" class="edit_url" />
            <td width="30px" valign="top">
                <?php echo $admin->id; ?>
            </td>
            <td valign="top">
                <?php echo $admin->name; ?>
            </td>
            <td valign="top">
                <?php echo $admin->username; ?>
            </td>
            <td valign="top">
                <a target="_blank" href="<?php echo site_url('admin/site/role/edit/id/' . $admin->role_id, true); ?>"><?php echo $admin->role_name; ?></a>
            </td>
            <td valign="top">
                <?php if ($admin->is_active == 1) :?>
                <span class="icon icon_active"></span>
                <?php else :?>
                <span class="icon icon_deactive"></span>
                <?php endif; ?>
            </td>
            <td valign="top">
                <?php echo $admin->email; ?>
            </td>
            <td valign="top">
                <p><a class="ajax_link icon icon_edit" data="{id:<?php echo $admin->id; ?>}" selector="#tab_edit" item="#active_tab_edit a" href="<?php echo site_url('admin/site/admin/ajax_edit/id/' . $admin->id, true); ?>"></a> <a class="icon icon_delete" href="<?php echo site_url('admin/site/admin/delete/id/' . $admin->id, true); ?>" onclick="return confirm('Bạn muốn xóa người dùng này?')"></a></p>
            </td>
        </tr>
        <?php endforeach; ?>
    <?php else :?>
        <tr id="filter_empty">
            <td colspan="7"><p align="center">Không tìm thấy người dùng theo tiêu chí tìm kiếm</p></td>
        </tr>
    <?php endif; ?>
    </tbody>
    <tfoot></tfoot>
</table>